package com.shopping.manager.service.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shopping.manager.mapper.TbItemMapper;
import com.shopping.manager.pojo.TbItem;
import com.shopping.manager.pojo.TbItemExample;
import com.shopping.manager.service.ItemService;


@Service
public class ItemServiceImpl implements ItemService{
	
	@Autowired
	private TbItemMapper itemMapper;
	
	@Override
	public TbItem getItemById(long id) {
		TbItemExample example = new TbItemExample();
		example.createCriteria().andIdEqualTo(id);
		List<TbItem> list =itemMapper.selectByExample(example );
		if (list!=null&&list.size()>0) {
			return list.get(0);
		}
		return null;
	}

}
